import React, { Component } from 'react'
import PropTypes from "prop-types"
import Item from "../Item"
import "./index.css"

export default class List extends Component {
    static propTypes = {
        todos: PropTypes.array.isRequired,
        updateTodo: PropTypes.func.isRequired,
        removeItem: PropTypes.func.isRequired
    }
    render() {
        const { todos,updateTodo,removeItem } = this.props;
        return (
            <ul className="todo-main">
                {
                    todos.map((item) => {
                        return <Item removeItem={removeItem} key={item.id} {...item} updateTodo={updateTodo} />
                    })
                }
            </ul>
        )
    }
}
